#include "CApp.h"
 
bool CApp::OnInit() {

	cout<<"Hello world"<<endl;

    if(SDL_Init(SDL_INIT_EVERYTHING) < 0) {
        return false;
    }
 
    if((Surf_Display = SDL_SetVideoMode(CSettings::WWIDTH, CSettings::WHEIGHT, 32, SDL_HWSURFACE | SDL_DOUBLEBUF)) == nullptr) {
        return false;
    }

	//if((Surf_Leo = CSurface::OnLoad("./gfx/leo_less.bmp")) == nullptr)
	//{
	//	return false;
	//}

	//Anim_Leo.MaxFrames = 5;
	//Anim_Leo.Oscillate = true;

	// CSurface::Transparent(Surf_Leo, 0, 0, 0);

	if(CArea::AreaControl.OnLoad("./maps/1.area") == false)
	{
		return false;
	}
	

	if((Player1.OnLoad("./gfx/yoshi2.png", 64, 64, 8))==false)
		false;
 
	if((Player2.OnLoad("./gfx/yoshi2.png", 64, 64, 8))==false)
		false;

	Player2.X = 300;

	CEntity::EntityList.push_back(&Player1);
	CEntity::EntityList.push_back(&Player2);

	CCamera::CameraControl.TargetMode = TARGET_MODE_CENTER;
	CCamera::CameraControl.SetTarget(&Player1.X, &Player1.Y);

	//Enable keyboard repeat count;
	SDL_EnableKeyRepeat(1,SDL_DEFAULT_REPEAT_INTERVAL / 3);

    return true;
}